// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   BubbleChart.java

package org.achartengine.chart;

import android.graphics.*;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.model.XYValueSeries;
import org.achartengine.renderer.*;

// Referenced classes of package org.achartengine.chart:
//			XYChart

public class BubbleChart extends XYChart
{

	public static final String TYPE = "Bubble";
	private static final int SHAPE_WIDTH = 10;
	private static final int MIN_BUBBLE_SIZE = 2;
	private static final int MAX_BUBBLE_SIZE = 20;

	BubbleChart()
	{
	}

	public BubbleChart(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
	{
		super(xymultipleseriesdataset, xymultipleseriesrenderer);
	}

	public void drawSeries(Canvas canvas, Paint paint, float af[], SimpleSeriesRenderer simpleseriesrenderer, float f, int i)
	{
		XYSeriesRenderer xyseriesrenderer = (XYSeriesRenderer)simpleseriesrenderer;
		paint.setColor(xyseriesrenderer.getColor());
		paint.setStyle(android.graphics.Paint.Style.FILL);
		int j = af.length;
		XYValueSeries xyvalueseries = (XYValueSeries)mDataset.getSeriesAt(i);
		double d = xyvalueseries.getMaxValue();
		double d1 = 20D / d;
		for (int k = 0; k < j; k += 2)
		{
			double d2 = xyvalueseries.getValue(k / 2) * d1 + 2D;
			drawCircle(canvas, paint, af[k], af[k + 1], (float)d2);
		}

	}

	protected RectF[] clickableAreasForPoints(float af[], float f, int i)
	{
		int j = af.length;
		XYValueSeries xyvalueseries = (XYValueSeries)mDataset.getSeriesAt(i);
		double d = xyvalueseries.getMaxValue();
		double d1 = 20D / d;
		RectF arectf[] = new RectF[j / 2];
		for (int k = 0; k < j; k += 2)
		{
			double d2 = xyvalueseries.getValue(k / 2) * d1 + 2D;
			arectf[k / 2] = new RectF(af[k] - (float)d2, af[k + 1] - (float)d2, af[k] + (float)d2, af[k + 1] + (float)d2);
		}

		return arectf;
	}

	public int getLegendShapeWidth(int i)
	{
		return 10;
	}

	public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer simpleseriesrenderer, float f, float f1, int i, Paint paint)
	{
		paint.setStyle(android.graphics.Paint.Style.FILL);
		drawCircle(canvas, paint, f + 10F, f1, 3F);
	}

	private void drawCircle(Canvas canvas, Paint paint, float f, float f1, float f2)
	{
		canvas.drawCircle(f, f1, f2, paint);
	}

	public String getChartType()
	{
		return "Bubble";
	}
}
